/**
* <p>Title: ThreadPoolHandler.java</p>
* <p>Description: </p>
* <p>Company: www.huoyunren.com</p>
* @author duanxiangyun
* @date 2016年5月18日
* @version 1.0
*/
package com.hxbd.test.handles;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class ThreadPoolHandler {
	private static final int minThreadSize=20;             //线程池最小的线程数量

	 private static final int maxThreadSize=100;             //线程池最大的线程数量

	 private static final int keepAliveTime=600;             //空闲时间
	  // 构造一个线程池

	 private static final ThreadPoolExecutor threadPool = new ThreadPoolExecutor(

	    minThreadSize,maxThreadSize,keepAliveTime,

	    TimeUnit.SECONDS, 

	    new ArrayBlockingQueue<Runnable>(5),

	    new ThreadPoolExecutor.CallerRunsPolicy());

	public static int getMinthreadsize() {
		return minThreadSize;
	}

	public static int getMaxthreadsize() {
		return maxThreadSize;
	}

	public static int getKeepalivetime() {
		return keepAliveTime;
	}

	public static ThreadPoolExecutor getThreadpool() {
		return threadPool;
	}
}
